package zj.it.bhne.gridengineeringsurvey.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.ArrayList;

import zj.it.bhne.gridengineeringsurvey.R;
import zj.it.bhne.gridengineeringsurvey.entity.OffLinebBean;

public class CityChildAdapter extends BaseAdapter{
    ArrayList<OffLinebBean.CityChilden>mData;
    Context mcontex;
   public CityChildAdapter(ArrayList<OffLinebBean.CityChilden>mData, Context context){
        this.mData=mData;
        this.mcontex=context;
    }
    @Override
    public int getCount() {
        return mData.size();
    }

    @Override
    public Object getItem(int i) {
        return mData.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
       ViewHolder viewHolder;
       if(view==null){
           viewHolder=new ViewHolder();
           view=LayoutInflater.from(mcontex).inflate(R.layout.offline_citychild_item,null);
           viewHolder.mCityName=view.findViewById(R.id.offline_item_tv);
           view.setTag(viewHolder);
       }else{
           viewHolder= (ViewHolder) view.getTag();
       }
       viewHolder.mCityName.setText(mData.get(i).cityChildInformessage);
        return view;
    }
    class ViewHolder{
       TextView mCityName;
    }
}
